<template>
	<view>
		<view class="wrap">
			<view class="u-tabs-box">
				<u-tabs-swiper activeColor="#f29100" ref="tabs" :list="list" :current="current" @change="change" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
			</view>
			<swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="page-box">
							<view class="order" v-for="(res, index) in orderList[0]" :key="res.id">
								<view class="top">
									<view class="left">
										<view class="store">订单编号：{{ res.store }}</view>
									</view>
									<view class="right">{{ res.deal }}</view>
								</view>
								<view class="item" v-for="(item, index) in res.goodsList" :key="index">
									<view class="left"><image :src="item.goodsUrl" mode="aspectFill"></image></view>
									<view class="content">
										<view class="title u-line-2">{{ item.title }}</view>
										<view class="type">
											<view class="trueNum">
												￥139.00
											</view>
											<view class="falesNum">
												￥268.00
											</view>
										</view>
									</view>
									<view class="right">
										<view class="price">
										</view>
									</view>
								</view>
								<view class="total">
									<view class="msg" v-for="">
										<view class="listleft">
											下单时间
										</view>
										<view class="listRighe">
											{{res.orderTime}}
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											买家用户名
										</view>
										<view class="listRighe">
											{{res.buyerName}}
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											收货人姓名
										</view>
										<view class="listRighe">
											{{res.consigneeName}}
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											收货人电话
										</view>
										<view class="listRighe">
											{{res.consigneePhp}}
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											所属仓库
										</view>
										<view class="listRighe">
											{{res.Warehouse}}号仓库
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											配送方式
										</view>
										<view class="listRighe">
											{{res.mode}}
										</view>
									</view>
								</view>
								<view class="bottom">
									<view class="evaluate btn" @click="toDeliver">发货</view>
									<view class="logistics btn" @click="show = true">打印</view>
									<view class="exchange btn" @click="toVieworder">查看订单</view>
								</view>
							</view>
							<u-loadmore :status="loadStatus[0]" bgColor="#f2f2f2"></u-loadmore>
						</view>
					</scroll-view>
				</swiper-item>
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="page-box">
							<view class="order" v-for="(res, index) in  orderList[1]" :key="res.id">
								<view class="top">
									<view class="left">
										<view class="store">订单编号：{{ res.store }}</view>
									</view>
									<view class="right">{{ res.deal }}</view>
								</view>
								<view class="item" v-for="(item, index) in res.goodsList" :key="index">
									<view class="left"><image :src="item.goodsUrl" mode="aspectFill"></image></view>
									<view class="content">
										<view class="title u-line-2">{{ item.title }}</view>
										<view class="type">
											<view class="trueNum">
												￥139.00
											</view>
											<view class="falesNum">
												￥268.00
											</view>
										</view>
									</view>
									<view class="right">
									</view>
								</view>
								<view class="total">
									<view class="msg">
										<view class="listleft">
											下单时间
										</view>
										<view class="listRighe">
											2020.07.22 12.56.22
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											买家用户名
										</view>
										<view class="listRighe">
											买家用户名
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											收货人姓名
										</view>
										<view class="listRighe">
											收货人姓名
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											收货人电话
										</view>
										<view class="listRighe">
											12345678933
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											所属仓库
										</view>
										<view class="listRighe">
											1号仓库
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											配送方式
										</view>
										<view class="listRighe">
											同城配送
										</view>
									</view>
								</view>
								<view class="bottom">
									<view class="evaluate btn" @click="toDeliver">发货</view>
									<view class="logistics btn" @click="show = true">打印</view>
									<view class="exchange btn" @click="toVieworder">查看订单</view>
								</view>
							</view>
							<u-loadmore :status="loadStatus[1]" bgColor="#f2f2f2"></u-loadmore>
						</view>
					</scroll-view>
				</swiper-item>
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="page-box">
							<view class="order" v-for="(res, index) in orderList[2]" :key="res.id">
								<view class="top">
									<view class="left">
										<view class="store">订单编号：{{ res.store }}</view>
									</view>
									<view class="right">{{ res.deal }}</view>
								</view>
								<view class="item" v-for="(item, index) in res.goodsList" :key="index">
									<view class="left"><image :src="item.goodsUrl" mode="aspectFill"></image></view>
									<view class="content">
										<view class="title u-line-2">{{ item.title }}</view>
										<view class="type">
											<view class="trueNum">
												￥139.00
											</view>
											<view class="falesNum">
												￥268.00
											</view>
										</view>
									</view>
									<view class="right">
										<view class="price">
										</view>
									</view>
								</view>
								<view class="total">
									<view class="msg" v-for="">
										<view class="listleft">
											下单时间
										</view>
										<view class="listRighe">
											{{res.orderTime}}
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											买家用户名
										</view>
										<view class="listRighe">
											{{res.buyerName}}
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											收货人姓名
										</view>
										<view class="listRighe">
											{{res.consigneeName}}
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											收货人电话
										</view>
										<view class="listRighe">
											{{res.consigneePhp}}
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											所属仓库
										</view>
										<view class="listRighe">
											{{res.Warehouse}}号仓库
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											配送方式
										</view>
										<view class="listRighe">
											{{res.mode}}
										</view>
									</view>
								</view>
								<view class="bottom">
									<view class="exchange btn lastright" @click="toVieworder">查看订单</view>
								</view>
							</view>
							<u-loadmore :status="loadStatus[2]" bgColor="#f2f2f2"></u-loadmore>
						</view>
					</scroll-view>
				</swiper-item>
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="page-box">
							<view class="order" v-for="(res, index) in  orderList[3]" :key="res.id">
								<view class="top">
									<view class="left">
										<view class="store">订单编号：{{ res.store }}</view>
									</view>
									<view class="right">{{ res.deal }}</view>
								</view>
								<view class="item" v-for="(item, index) in res.goodsList" :key="index">
									<view class="left"><image :src="item.goodsUrl" mode="aspectFill"></image></view>
									<view class="content">
										<view class="title u-line-2">{{ item.title }}</view>
										<view class="type">
											<view class="trueNum">
												￥139.00
											</view>
											<view class="falesNum">
												￥268.00
											</view>
										</view>
									</view>
									<view class="right">
									</view>
								</view>
								<view class="total">
									<view class="msg">
										<view class="listleft">
											下单时间
										</view>
										<view class="listRighe">
											2020.07.22 12.56.22
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											买家用户名
										</view>
										<view class="listRighe">
											买家用户名
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											收货人姓名
										</view>
										<view class="listRighe">
											收货人姓名
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											收货人电话
										</view>
										<view class="listRighe">
											12345678933
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											所属仓库
										</view>
										<view class="listRighe">
											1号仓库
										</view>
									</view>
									<view class="msg">
										<view class="listleft">
											配送方式
										</view>
										<view class="listRighe">
											同城配送
										</view>
									</view>
								</view>
								<view class="bottom">
									<view class="exchange btn lastright" @click="toVieworder">查看订单</view>
								</view>
							</view>
							<u-loadmore :status="loadStatus[3]" bgColor="#f2f2f2"></u-loadmore>
						</view>
					</scroll-view>
				</swiper-item>
			</swiper>
		</view>
			<!-- 弹出 -->
		<u-popup v-model="show" class="OrderPop" mode="center">
				<view class="title">
					打印订单
				</view>
				<view class="Printinglist">
					<view class="Printmsg">
						<view class="left">
							收货人姓名:
						</view>
						<view class="right">
							张三
						</view>
					</view>
					<view class="Printmsg">
						<view class="left">
							收货人电话:
						</view>
						<view class="right">
							123456788778
						</view>
					</view>
					<view class="Printmsg">
						<view class="left">
							收货人地址:
						</view>
						<view class="right">
							四川省 成都市 成华区 青龙场街5号北回归线8栋1203号(虚拟的收货地址)
						</view>
					</view>
					<view class="Printmsg">
						<view class="left">
							发货人姓名:
						</view>
						<view class="right">
							爱贝丽商场
						</view>
					</view>
					<view class="Printmsg">
						<view class="left">
							发货人电话:
						</view>
						<view class="right">
							028-6541031
						</view>
					</view>
					<view class="Printmsg">
						<view class="left">
							发货人地址:
						</view>
						<view class="right">
							四川省 成都市 成华区 青龙场街5号北回归线8栋1203号(虚拟的收货地址）
						</view>
					</view>
				</view>
				<view class="printBtn">
					<view class="Btn" @click="show = false">
						取消
					</view>
					<view class="Btn subtim">
						打印
					</view>
				</view>
		</u-popup>
	</view>
</template>

<script>
export default {
	data() {
		return {
			orderList: [[], [], [], []],
			dataList: [
				{
					id: 1,
					store: '23847563928174',
					deal: '待付款',
					goodsList: [
						{
							goodsUrl: '//img13.360buyimg.com/n7/jfs/t1/103005/7/17719/314825/5e8c19faEb7eed50d/5b81ae4b2f7f3bb7.jpg',
							title: '【冬日限定】现货 原创jk制服女2020冬装新款小清新宽松软糯毛衣外套女开衫短款百搭日系甜美风',
						}
					],
					orderTime:'2020.07.22 12.56.22',
					buyerName:'买家用户名',
					consigneeName:'收货人姓名',
					consigneePhp:'收货人电话',
					Warehouse:'1',
					mode:'同城配送'
				},
				{
					id: 2,
					store: '23847563928174',
					deal: '待发货',
					goodsList: [
						{
							goodsUrl: '//img14.360buyimg.com/n7/jfs/t1/60319/15/6105/406802/5d43f68aE9f00db8c/0affb7ac46c345e2.jpg',
							title: '【冬日限定】现货 原创jk制服女2020冬装新款小清新宽松软糯毛衣外套女开衫短款百搭日系甜美风',
							
						}
					],
					orderTime:'2020.07.22 12.56.22',
					buyerName:'买家用户名',
					consigneeName:'收货人姓名',
					consigneePhp:'收货人电话',
					Warehouse:'1',
					mode:'同城配送'
				},
				{
					id: 3,
					store: '23847563928174',
					deal: '待发货',
					goodsList: [
						{
							goodsUrl: '//img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg',
							title: '三星（SAMSUNG）京品家电 UA65RUF70AJXXZ 65英寸4K超高清 HDR 京东微联 智能语音 教育资源液晶电视机',
							
						}
					],
					orderTime:'2020.07.22 12.56.22',
					buyerName:'买家用户名',
					consigneeName:'收货人姓名',
					consigneePhp:'收货人电话',
					Warehouse:'1',
					mode:'同城配送'
				},
				{
					id: 4,
					store: '23847563928174',
					deal: '待发货',
					goodsList: [
						{
							goodsUrl: '//img10.360buyimg.com/n7/jfs/t22300/31/1505958241/171936/9e201a89/5b2b12ffNe6dbb594.jpg!q90.jpg',
							title: '法国进口红酒 拉菲（LAFITE）传奇波尔多干红葡萄酒750ml*6整箱装',
							
						}
					],
					orderTime:'2020.07.22 12.56.22',
					buyerName:'买家用户名',
					consigneeName:'收货人姓名',
					consigneePhp:'收货人电话',
					Warehouse:'1',
					mode:'同城配送'
				},
				{
					id: 5,
					store: '23847563928174',
					deal: '待发货',
					goodsList: [
						{
							goodsUrl: '//img12.360buyimg.com/n7/jfs/t1/52408/35/3554/78293/5d12e9cfEfd118ba1/ba5995e62cbd747f.jpg!q90.jpg',
							title: '企业微信 中控人脸指纹识别考勤机刷脸机 无线签到异地多店打卡机WX108',
							
						}
					],
					orderTime:'2020.07.22 12.56.22',
					buyerName:'买家用户名',
					consigneeName:'收货人姓名',
					consigneePhp:'收货人电话',
					Warehouse:'1',
					mode:'同城配送'
				}
			],
			list: [
				{
					name: '全部'
				},
				{
					name: '待发货'
				},
				{
					name: '配送中'
				},
				{
					name: '维权'
				}
			],
			current: 0,
			swiperCurrent: 0,
			tabsHeight: 0,
			dx: 0,
			loadStatus: ['loadmore','loadmore','loadmore','loadmore'],
			show:false
		};
	},
	onLoad() {
		this.getOrderList(0);
		this.getOrderList(1);
		this.getOrderList(3);
	},
	computed: {
		// 价格小数
		priceDecimal() {
			return val => {
				if (val !== parseInt(val)) return val.slice(-2);
				else return '00';
			};
		},
		// 价格整数
		priceInt() {
			return val => {
				if (val !== parseInt(val)) return val.split('.')[0];
				else return val;
			};
		}
	},
	methods: {
		reachBottom() {
			// 此tab为空数据
			if(this.current != 2) {
				this.loadStatus.splice(this.current,1,"loading")
				setTimeout(() => {
					this.getOrderList(this.current);
				}, 1200);
			}
		},
		// 页面数据
		getOrderList(idx) {
			for(let i = 0; i < 5; i++) {
				let index = this.$u.random(0, this.dataList.length - 1);
				let data = JSON.parse(JSON.stringify(this.dataList[index]));
				data.id = this.$u.guid();
				this.orderList[idx].push(data);
			}
			this.loadStatus.splice(this.current,1,"loadmore")
		},
		// tab栏切换
		change(index) {
			this.swiperCurrent = index;
			this.getOrderList(index);
		},
		transition({ detail: { dx } }) {
			this.$refs.tabs.setDx(dx);
		},
		animationfinish({ detail: { current } }) {
			this.$refs.tabs.setFinishCurrent(current);
			this.swiperCurrent = current;
			this.current = current;
		},
		//跳转查看订单
		toVieworder:function(){
			uni.navigateTo({
				url:'./viewOrder'
			})
		},
		//发货
		toDeliver:function(){
			uni.navigateTo({
				url:'./Delivered'
			})
		}
	}
};
</script>

<style>
/* #ifndef H5 */
page {
	height: 100%;
	background-color: #f2f2f2;
}
/* #endif */
</style>

<style lang="scss" scoped>
.order {
	width: 710rpx;
	background-color: #ffffff;
	margin: 20rpx auto;
	border-radius: 20rpx;
	box-sizing: border-box;
	padding: 20rpx;
	font-size: 28rpx;
	.top {
		display: flex;
		justify-content: space-between;
		.left {
			display: flex;
			align-items: center;
			.store {
				margin: 0 10rpx;
				font-size:24rpx;
				font-family:PingFang SC;
				font-weight:bold;
				color:rgba(153,153,153,1)
			}
		}
		.right {
			color: $u-type-warning-dark;
		}
	}
	.item {
		display: flex;
		margin: 20rpx 0 0;
		.left {
			margin-right: 20rpx;
			image {
				width: 200rpx;
				height: 200rpx;
				border-radius: 10rpx;
			}
		}
		.content {
			.title {
				font-size: 28rpx;
				line-height: 50rpx;
			}
			.type {
				margin-top: 55rpx;
				display: flex;
				font-size:32rpx;
				font-family:PingFang SC;
				font-weight:500;
				color:rgba(242,73,81,1);
				line-height:38rpx;
				.falesNum{
					text-decoration:line-through;
					color: #A3A3A3;
					font-size:22rpx;
				}
			}
			.delivery-time {
				color: #e5d001;
				font-size: 24rpx;
			}
		}
		.right {
			margin-left: 10rpx;
			padding-top: 20rpx;
			text-align: right;
			.decimal {
				font-size: 24rpx;
				margin-top: 4rpx;
			}
			.number {
				color: $u-tips-color;
				font-size: 24rpx;
			}
		}
	}
	.total {
		margin-top: 20rpx;
		// text-align: right;
		font-size: 24rpx;
		.msg{
			display: flex;
			margin-top: 47rpx;
			.listleft{
				width:130rpx;
				height:25rpx;
				font-size:26rpx;
				font-family:PingFang SC;
				font-weight:500;
				color:rgba(153,153,153,1);
				line-height:38rpx;
				margin-right: 58rpx;
			}
			.listRighe{
				width:268rpx;
				height:21rpx;
				font-size:26rpx;
				font-family:PingFang SC;
				font-weight:bold;
				color:rgba(51,51,51,1); 
				line-height:38rpx;
			}
			
		}
		.total-price {
			font-size: 32rpx;
		}
	}
	.bottom {
		display: flex;
		margin-top: 65rpx;
		padding: 0 10rpx;
		flex-direction: row-reverse;
		align-items: center;
		.btn {
			line-height: 52rpx;
			width: 160rpx;
			border-radius: 26rpx;
			border: 2rpx solid $u-border-color;
			font-size: 26rpx;
			text-align: center;
			color: $u-type-info-dark;
			margin-left: 20rpx;
		}
		.evaluate {
			color: #FFFFFF;
			background-color: #0199FE;
		}
		.lastright{
			color: #FFFFFF;
			background-color: #0199FE;
		}
	}
}
.centre {
	text-align: center;
	margin: 200rpx auto;
	font-size: 32rpx;
	image {
		width: 164rpx;
		height: 164rpx;
		border-radius: 50%;
		margin-bottom: 20rpx;
	}
	.tips {
		font-size: 24rpx;
		color: #999999;
		margin-top: 20rpx;
	}
	.btn {
		margin: 80rpx auto;
		width: 200rpx;
		border-radius: 32rpx;
		line-height: 64rpx;
		color: #ffffff;
		font-size: 26rpx;
		background: linear-gradient(270deg, rgba(249, 116, 90, 1) 0%, rgba(255, 158, 1, 1) 100%);
	}
}
.OrderPop{
	width:610rpx;
	height:900rpx;
	margin: auto;
	text-align: center;
	.title{
		width: 610rpx;
		line-height: 92rpx;
		font-size:30rpx;
		font-family:PingFang SC;
		font-weight:bold;
		color:rgba(51,51,51,1);
		margin-bottom: 15rpx;
	}
	.Printinglist{
		.Printmsg{
			display: flex;
			justify-content: space-between;
			width: 550rpx;
			margin:0 auto 10rpx;
			min-height: 100rpx;
			.left{
				font-size:26rpx;
				font-family:PingFang SC;
				font-weight:500;
				color:rgba(153,153,153,1);
			}
			.right{
				width: 380rpx;
				text-align: left;
				font-size:26rpx;
				font-family:PingFang SC;
				font-weight:500;
				color:rgba(51,51,51,1);
			}
		}
	}
	.printBtn{
		width: 550rpx;
		margin: auto;
		display: flex;
		justify-content: space-between;
		padding: 20rpx 0;
		.Btn{
			width:264rpx;
			height:80rpx;
			background:rgba(255,255,255,1);
			border:1px solid rgba(230,230,230,1);
			border-radius:40rpx;
			font-size:30rpx;
			font-family:PingFang SC;
			font-weight:bold;
			color:rgba(51,51,51,1);
			line-height: 80rpx;
		}
		.subtim{
			background:rgba(1,153,254,1);
			color:rgba(255,255,255,1);
			
		}
	}
}
.wrap {
	display: flex;
	flex-direction: column;
	height: calc(100vh - var(--window-top));
	width: 100%;
}
.swiper-box {
	flex: 1;
}
.swiper-item {
	height: 100%;
}
</style>
